﻿using BCCommon.Enums;
using BCEntity.Sim.Company.Company;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Sim.Company.Company
{
    /// <summary>
    /// 公司配置
    /// </summary>
    public interface ICompanyData
    {
        /// <summary>
        /// 检查公司是否存在
        /// </summary>
        /// <returns></returns>
        Task<bool> CheckCompanyExists(int companyId);
        /// <summary>
        /// 检查是否为公司负责人
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<bool> CheckCompanyHeadExists(long adminId);
        /// <summary>
        /// 检查公司名称缩写是否存在
        /// </summary>
        /// <param name="companySubName">公司名称缩写</param>
        /// <param name="companyId">公司配置Id</param>
        /// <returns></returns>
        Task<bool> CheckCompanySubNameExists(string companySubName, int? companyId);
        /// <summary>
        /// 获取公司
        /// </summary>
        /// <param name="companyId">公司配置Id</param>
        /// <returns></returns>
        Task<CompanyEntity> GetEntity(int companyId);
        /// <summary>
        /// 获取公司列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<CompanyEntity>> GetList();
        /// <summary>
        /// 查询公司信息（分页）
        /// </summary>
        /// <param name="companyBusinessTypeCode">公司业务类型</param>
        /// <param name="companyName">公司名称</param>
        /// <param name="companyStatus">公司运营状态</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        Task<(IEnumerable<CompanyEntity>, int)> Query(string companyBusinessTypeCode, string companyName, CompanyStatus? companyStatus, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
        /// <summary>
        /// 添加公司配置
        /// </summary>
        /// <param name="companyEntity">公司配置</param>
        /// <returns></returns>
        Task<CompanyEntity> Add(CompanyEntity companyEntity);
        /// <summary>
        /// 修改公司配置
        /// </summary>
        /// <param name="companyEntity">公司配置</param>
        /// <returns></returns>
        Task<CompanyEntity> Update(CompanyEntity companyEntity);
        /// <summary>
        /// 删除公司配置
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        Task<bool> Delete(int companyId);
      
        /// <summary>
        /// 更新公司为已使用
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        Task<bool> UpdateInUsed(int companyId);
        /// <summary>
        /// 更新公司为未使用
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        Task<bool> UpdateUnused(int companyId);

        /// <summary>
        /// 更新公司表负责人ID
        /// </summary>
        /// <param name="companyId">公司ID</param>
        /// <param name="adminId">负责人ID</param>
        /// <returns></returns>
        Task<int> UpdateCompanyAdminId(long companyId, long adminId);
    }
}
